Intro

We said an intelligent agent takes perceptual history and converts to action

Percepts -> actions

Planning helps in action selection.

Propositional Logic

Description P Logic
Robot has to paint the ceiling Painted(Ceiling)
Robot has to paint the ladder Painted(Ladder)
Conjunction Painted(Ceiling) & Painted(Ladder)

States

2019-06-19_10h30_21.png

Exercise

2019-06-19_10h31_56.png

Operator

2019-06-19_10h34_43.png

  • By convention, precondition has all literals positive, postcondition may have negative literals
  • precondtion results are true in world before operator applied
  • postcondition results will become true in world after operator applied
  • operator can be applied only if precondition is true

Exercise

descend-ladder precondition: Robot should be already on Ladder, and Ladder should be dry postcondition: Robot is on floor

paint-ceiling pre: Robot should be on Ladder, Ladder is dry, and Ceiling is also dry post: ceiling painted and not dry anymore

paint-ladder pre: Robot should be on Floor and ladder dry post: ladder painted and not dry anymore

Correct answer: 2019-06-19_10h51_16.png

Make sure to correct to have only positive literals in pre conditions

Planning and State Spaces

Note how states where the operator is applied satisfies both pre and post condition (and that is why that operator was selected in first place). Also note statse have negative literals, while operator preconditions do not.

2019-06-19_10h59_54.png

MEA problem

Step 1

%3 A On(Robot,Floor) & Dry(Ladder) & Dry(Ceiling) Initial  Delta:2 B Painted(Ladder) & Painted(Ceiling) Goal Delta:0

Current State: on which operators should be applied next

Current State
On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling)

Available Operators

Operator Pre condition Post Condition
climb-ladder On(Robot, Floor) & Dry(Ladder) On(Robot, Ladder)
descend-ladder On(Robot, Ladder) & Dry(Ladder) On(Robot, Floor)
paint-ceiling On(Robot, Ladder) Painted(Ceiling) & !Dry(Ceiling)
paint-ladder On(Robot, Floor) Painted(Ladder) & !Dry(Ladder)

Applicable Operators: If not applicable, can be down right rejected anyway.

Operator Pre condition Post Condition Applicability Why?
climb-ladder On(Robot, Floor) & Dry(Ladder) On(Robot, Ladder) yes pre condition satisfied
descend-ladder On(Robot, Ladder) & Dry(Ladder) On(Robot, Floor) no pre condition not satisfied
paint-ceiling On(Robot, Ladder) Painted(Ceiling) & !Dry(Ceiling) no pre condition not satisfied
paint-ladder On(Robot, Floor) Painted(Ladder) & !Dry(Ladder) yes pre condition satisfied

Delta: For those applicable, which ever has least delta should be chosen

Operator Current State Post Condition Next State Delta
climb-ladder On(Robot, Floor) & Dry(Ladder)
& Dry(Ceiling)
On(Robot, Ladder) On(Robot, Ladder) & Dry(Ladder)
& Dry(Ceiling)
2
paint-ladder On(Robot, Floor) & Dry(Ladder)
& Dry(Ceiling)
Painted(Ladder) & !Dry(Ladder) On(Robot, Floor) & !Dry(Ladder)
& Dry(Ceiling) & Painted(Ladder)
1

So paint-ladder is best choice as per MEA at this step

Step 2

%3 A On(Robot,Floor) & Dry(Ladder) & Dry(Ceiling) Initial  Delta:2 C On(Robot, Floor) & !Dry(Ladder) & Dry(Ceiling) & Painted(Ladder) paint-ladder, Delta=1 A->C B Painted(Ladder) & Painted(Ceiling) Goal Delta:0

Current State:

Current State
On(Robot, Floor) & !Dry(Ladder) & Dry(Ceiling) & Painted(Ladder)

Available Operators

Operator Pre condition Post Condition
climb-ladder On(Robot, Floor) & Dry(Ladder) On(Robot, Ladder)
descend-ladder On(Robot, Ladder) & Dry(Ladder) On(Robot, Floor)
paint-ceiling On(Robot, Ladder) Painted(Ceiling) & !Dry(Ceiling)
paint-ladder On(Robot, Floor) Painted(Ladder) & !Dry(Ladder)

Applicable Operators: Based on satisfying pre condition..

Operator Pre condition Post Condition Applicability
climb-ladder On(Robot, Floor) & Dry(Ladder) On(Robot, Ladder) No
descend-ladder On(Robot, Ladder) & Dry(Ladder) On(Robot, Floor) No
paint-ceiling On(Robot, Ladder) Painted(Ceiling) & !Dry(Ceiling) No
paint-ladder On(Robot, Floor) Painted(Ladder) & !Dry(Ladder) yes

MEA according to me is stuck in a conflict of painting again and again.

Exercise: Partial Order Planning

Sample

%3 A On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling) Initial, Delta=1 B Painted(Ladder) Goal, Delta = 0

Current State

Current State
On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling)

Applicable Operators

Operator Pre condition Post Condition Applicability
climb-ladder On(Robot, Floor) & Dry(Ladder) On(Robot, Ladder) yes
descend-ladder On(Robot, Ladder) & Dry(Ladder) On(Robot, Floor) no
paint-ceiling On(Robot, Ladder) Painted(Ceiling) & !Dry(Ceiling) no
paint-ladder On(Robot, Floor) Painted(Ladder) & !Dry(Ladder) yes

Delta for applicable operators

Operator Current State Post Condition Next State Delta
climb-ladder On(Robot, Floor) & Dry(Ladder)
& Dry(Ceiling)
On(Robot, Ladder) On(Robot, Ladder) & Dry(Ladder)
& Dry(Ceiling)
1
paint-ladder On(Robot, Floor) & Dry(Ladder)
& Dry(Ceiling)
Painted(Ladder) & !Dry(Ladder) On(Robot, Floor) & !Dry(Ladder)
& Dry(Ceiling) & Painted(Ladder)
0

Not unlike earlier, this time, delta has reduced. Thus again paint-ladder is best choice for reduced goal of Painted(Ladder)

%3 A On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling) Initial, Delta=1 C On(Robot, Floor) & !Dry(Ladder) & Dry(Ceiling) & Painted(Ladder) paint-ladder, Delta=0 A->C B Painted(Ceiling) Goal, Delta = 0

Exercise

Step 1

%3 A On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling) Initial, Delta=1 B Painted(Ceiling) Goal, Delta = 0

Current State

Current State
On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling)

Applicable Operators

Operator Pre condition Post Condition Applicability
climb-ladder On(Robot, Floor) & Dry(Ladder) On(Robot, Ladder) yes
descend-ladder On(Robot, Ladder) & Dry(Ladder) On(Robot, Floor) no
paint-ceiling On(Robot, Ladder) Painted(Ceiling) & !Dry(Ceiling) no
paint-ladder On(Robot, Floor) Painted(Ladder) & !Dry(Ladder) yes

Delta for applicable operators

Operator Current State Post Condition Next State Delta
climb-ladder On(Robot, Floor) & Dry(Ladder)
& Dry(Ceiling)
On(Robot, Ladder) On(Robot, Ladder) & Dry(Ladder)
& Dry(Ceiling)
1
paint-ladder On(Robot, Floor) & Dry(Ladder)
& Dry(Ceiling)
Painted(Ladder) & !Dry(Ladder) On(Robot, Floor) & !Dry(Ladder)
& Dry(Ceiling) & Painted(Ladder)
1

But paint-ladder was already used in another sub goal. So only left out candidate is climb-ladder

%3 A On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling) Initial, Delta=1 C On(Robot, Ladder) & Dry(Ladder) & Dry(Ceiling) climb-ladder, Delta=1 A->C B Painted(Ceiling) Goal, Delta = 0

Step 2

Current State

Current State
On(Robot, Ladder) & Dry(Ladder) & Dry(Ceiling)

Applicable Operators

Operator Pre condition Post Condition Applicability
climb-ladder On(Robot, Floor) & Dry(Ladder) On(Robot, Ladder) x
descend-ladder On(Robot, Ladder) & Dry(Ladder) On(Robot, Floor) $$\checkmark$$
paint-ceiling On(Robot, Ladder) Painted(Ceiling) & !Dry(Ceiling) $$\checkmark$$
paint-ladder On(Robot, Floor) Painted(Ladder) & !Dry(Ladder) x

Delta for applicable operators

Operator Current State Post Condition Next State Delta
descend-ladder On(Robot, Ladder) & Dry(Ladder)
& Dry(Ceiling)
On(Robot, Floor) On(Robot, Floor) & Dry(Ladder)
& Dry(Ceiling)
1
paint-ceiling On(Robot, Ladder) & Dry(Ladder)
& Dry(Ceiling)
Painted(Ceiling) & !Dry(Ceiling) On(Robot, Ladder) & Dry(Ladder)
& Painted(Ceiling) & !Dry(Ceiling)
0

So here, paint-ceiling is next logical operator. Applying that,

%3 A On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling) Initial, Delta=1 C On(Robot, Ladder) & Dry(Ladder) & Dry(Ceiling) climb-ladder, Delta=1 A->C B Painted(Ceiling) Goal, Delta = 0 D On(Robot, Ladder) & Dry(Ladder) & Painted(Ceiling) & !Dry(Ceiling) paint-ceiling, Delta=0 C->D

Detecting Conflicts

2019-06-19_16h00_19.png

List out pre conditions of operators

%3 Goal: Painted(Ladder) A S1: On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling) B S2: On(Robot, Floor) & !Dry(Ladder) & Dry(Ceiling) & Painted(Ladder) paint-ladder, precond: On(Robot, Floor) A->B
%3 Goal: Painted(Ceiling) A S1: On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling) B S3: On(Robot, Ladder) & Dry(Ladder) & Dry(Ceiling) climb-ladder, precond: On(Robot, Floor) & Dry(Ladder) A->B C S4: On(Robot, Ladder) & Dry(Ladder) & Painted(Ceiling) & !Dry(Ceiling) paint-ceiling, precond: On(Robot, Ladder) B->C
Abbreviation State
S1 On(Robot, Floor) & Dry(Ladder) & Dry(Ceiling)
S2 On(Robot, Floor) & !Dry(Ladder) & Dry(Ceiling) & Painted(Ladder
S3 On(Robot, Ladder) & Dry(Ladder) & Dry(Ceiling)
S4 On(Robot, Ladder) & Dry(Ladder) & Painted(Ceiling) & !Dry(Ceiling)

Finding conflicts: shown by tick indicator.

For an operator in a plan/goal, find conflicts in other plan/goal. For eg, for paint-ladder, find in goal:Painting(ceiling) plan.

Operator Pre condition S1 S2 S3 S4
paint-ladder On(Robot, Floor) x NA x x
climb-ladder On(Robot, Floor) & Dry(Ladder) x $$\checkmark$$ NA NA
paint-ceiling On(Robot, Ladder) x x NA NA

climb-ladder has Dry(Ladder) and S2 has !Dry(Ladder) which is a conflict. So prefer the goal first where climb-ladder was involved and then go for other goal.

2019-06-19_16h40_37.png

Open Preconditions

Note S3 of Painted(Ceiling) the robot is on ladder, but S1 of Painted(Ladder) needs to have robot on floor. So there is a gap. Simply find from the remaining operators, which has the pre condition match with S3 of Painting(Ceiling) and post condition match with S1 of Painting(Ladder). Naturally its the descend-ladder

2019-06-19_16h44_55.png

Postulates

  • Knowledge is not just about world. Its also control-knowledge to select between operators
  • Goals provide control knowledge
  • Partial Order planning as interaction between several smaller agent with simpler goals independently
  • Society of Mind is an example

Quiz: Partial Order Planning (POP) I

2019-06-19_16h53_10.png

Quiz: POP II

Note, in order to move an X or Y, both should not have anything on top of them. This can be indicated by clear(x) for example.

2019-06-19_16h57_01.png

Quiz: POP III

When they ask plans, write the operators list

2019-06-19_17h01_43.png

Quiz: POP IV

Find Conflicts

2019-06-19_17h02_43.png

Goal: On(A,B)

%3 Goal: On(A,B) A S1: On(D,B) & On(B,A) & On(A,C) & On(C,Table) B S2: On(D,Table) & On(B,A) & On(A,C) & On(C,Table) Move(D,Table) PRECOND: clear(D) A->B C S3: On(D,Table) & On(B,Table) & On(A,C) & On(C,Table) Move(B,Table) PRECOND: clear(B) B->C D S4: On(D,Table) & On(B,Table) & On(A,B) & On(C,Table) Move(A,B) PRECOND: clear(B) & clear(A) C->D

Goal: On(B,C)

%3 Goal: On(B,C) A S1: On(D,B) & On(B,A) & On(A,C) & On(C,Table) B S2: On(D,Table) & On(B,A) & On(A,C) & On(C,Table) Move(D,Table) PRECOND: clear(D) A->B C S3: On(D,Table) & On(B,Table) & On(A,C) & On(C,Table) Move(B,Table) PRECOND: clear(B) B->C D S5: On(D,Table) & On(B,Table) & On(A, Table) & On(C,Table) Move(A,Table) PRECOND: clear(A) C->D E S6: On(D,Table) & On(B,C) & On(A,Table) & On(C,Table) Move(B,C) PRECOND: clear(B) & clear(C) D->E

Goal: On(C,D)

%3 Goal: On(C,D) A S1: On(D,B) & On(B,A) & On(A,C) & On(C,Table) B S2: On(D,Table) & On(B,A) & On(A,C) & On(C,Table) Move(D,Table) PRECOND: clear(D) A->B C S3: On(D,Table) & On(B,Table) & On(A,C) & On(C,Table) Move(B,Table) PRECOND: clear(B) B->C D S5: On(D,Table) & On(B,Table) & On(A, Table) & On(C,Table) Move(A,Table) PRECOND: clear(A) C->D E S7: On(D,Table) & On(B, Table) & On(A, Table) & On(C,D) Move(C,D) PRECOND: clear(C) & clear(D) D->E
$$ \newcommand{\ch}{\checkmark} $$

Since S1, S2, S3 are common for all plans, we could ignore them for a moment.

Abbreviation State Goal:On(A,B) Goal:On(B,C) Goal:On(C,D)
S4 On(D,Table) & On(B,Table) & On(A,B) & On(C,Table) $\ch$ x x
S5 On(D,Table) & On(B,Table) & On(A, Table) & On(C,Table) x $\ch$ $\ch$
S6 On(D,Table) & On(B,C) & On(A,Table) & On(C,Table) x $\ch$ x
S7 On(D,Table) & On(B, Table) & On(A, Table) & On(C,D) x x $\ch$

Finding conflicts:

as shown by tick indicator. For an operator in a plan/goal, find conflicts in other plans/goals. First let us identify where we need to check for conflicts, indicated by ?.

We could ignore all operators that are common for all plans also, for a moment,

Operator Pre condition S4 S5 S6 S7
Move(A,Table) Clear(A) ? _ _ _
Move(A,B) Clear(A) & Clear(B) _ ? ? ?
Move(B,C) Clear(B) & Clear(C) ? _ _ ?
Move(C,D) Clear(C) & Clear(D) ? ? ? _

Now marking the conflict by respective condition, and no conflict by x

Operator Pre condition S4 S5 S6 S7
Move(A,Table) Clear(A) x _ _ _
Move(A,B) Clear(A) & Clear(B) _ x x x
Move(B,C) Clear(B) & Clear(C) On(A,B) _ _ x
Move(C,D) Clear(C) & Clear(D) x x On(B,C) _

Above table illustrates

  • Move(C,D) of Goal:On(C,D) is clobbered by On(B,C) from S6 belonging to Goal:On(B,C)
  • Move(B,C) of Goal:On(B,C) is clobbered by On(A,B) from S4 belonging to Goal:On(A,B)

Conclusion

So

  • Prefer Goal:On(C,D) over Goal:On(B,C)
  • Prefer Goal:On(B,C) over Goal:On(A,B)

This implies, the order

  • Goal:On(C,D)
  • Goal:On(B,C)
  • Goal:On(A,B)

Quiz: POP V

Combining above Goals in order we get,

2019-06-19_19h14_12.png

Hierarchical Decomposition

Decompose, abstract

2019-06-19_19h18_13.png

2019-06-19_19h20_23.png

2019-06-19_19h20_41.png